#!/bin/bash
 
ENDPOINT=$(hostname -i):2379
cert="/etc/kubernetes/pki/etcd/server.crt"
key="/etc/kubernetes/pki/etcd/server.key"
cacert="/etc/kubernetes/pki/etcd/ca.crt"
back_data=/opt/snapshot/data
times=`date +%F-%R`


export ETCDCTL_API=3
etcdctl --endpoints=$ENDPOINT \
--cert=$cert \
--key=$key \
--cacert=$cacert \
snapshot save $back_data/snapshot-$times.db; \
echo etce backup success
echo "$ENDPOINT"
sleep 20
